package cn.tedu.hm.service.impl;

import cn.tedu.hm.mapper.OccupancyRateMapper;
import cn.tedu.hm.pojo.vo.OccupancyRateListItemVO;
import cn.tedu.hm.service.IOccupancyRateService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.List;

/**
 * @author tj41h
 */
@Slf4j
@Service
public class OccupancyRateServiceIpml implements IOccupancyRateService {

    @Autowired
    private OccupancyRateMapper occupancyRateMapper;

    @Override
    public List<OccupancyRateListItemVO> list(String timeString) {
        String[] split = timeString.split(",");
        String startTime = split[0];
        String endTime = split[1];
        List<OccupancyRateListItemVO> lists = occupancyRateMapper.list(startTime, endTime);
        for(OccupancyRateListItemVO list:lists){
            list.setCn(list.getCn()/50);
        }
        return lists;

    }
}
